package com.hqy.user.controller;

import com.hqy.user.dto.Result;
import com.hqy.user.service.UserService;
import com.hqy.user.dto.UserAddress;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping(value = "/api/user")
public class UserController {

    @Autowired
    private UserService userService;

    @GetMapping("/getUserAddress")
    public Result<Object> getUserAddress(){
        try {
            List<UserAddress> userAddressList = userService.getUserAddressList();
            return Result.ok(userAddressList);
        }catch (Exception e){
            return Result.fail();
        }
    }
}
